package com.wondertek.poms.dao.repo;

import com.wondertek.poms.dao.po.AlbumCont;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;


/**
 * @author gzx
 */
@Repository
public interface IAlbumContDao extends JpaRepository<AlbumCont,Long> {

  /** 查询专辑列表
   *@author gaozhengxing gaozhenghang@wondertek.com.cn
   *@date 2021/1/3 16:58
   *@param albumId 专辑对应的节目id
   *@return  专辑列表*/
  @Query(value = "select * from ALBUM_CONT where ALBUM_ID= ?1 order by sort", nativeQuery = true)
  List<AlbumCont> getAlbumContList(Long albumId);

   /** 查询专辑列表
   *@author gaozhengxing gaozhenghang@wondertek.com.cn
   *@date 2021/1/3 16:58
   *@param albumId 专辑对应的节目id
   *@return  专辑列表*/
   List<AlbumCont> findAlbumContsByAlbumIdOrderBySort(Long albumId);

    /** 初始化id
     *@author gaozhengxing gaozhenghang@wondertek.com.cn
     *@date 2021/1/3 16:58
     *@return  初始化id*/
    @Query(value = "select ALBUM_CONTENT_SEQ.Nextval from dual", nativeQuery = true)
    String initAlbumContentId();

    /** 初始化id
     *@author gaozhengxing gaozhenghang@wondertek.com.cn
     *@date 2021/1/3 16:58
     *@param albumContId 专辑对应的节目id
     *@param subPrdContId 专辑对应的产品包id
     *@return  初始化id*/
    AlbumCont findAlbumContByAlbumContIdAndSubPrdContId(String albumContId, Long subPrdContId);

  /** 初始化id
   *@author gaozhengxing gaozhenghang@wondertek.com.cn
   *@date 2021/1/3 16:58
   *@param albumContId 专辑对应的节目id
   *@return  初始化id*/
  AlbumCont findAlbumContByAlbumContId(String albumContId);

}
